<script src="../asynx.js"></script>
<script src="../dom/dom.js"></script>
<script src="../impl/array.js"></script>
<script src="../impl/util.js"></script>
<script src="../impl/cookie.js"></script>
<script src="../impl/ajax.js"></script>
<script src="../impl/lang.js"></script>
<script src="../dom/xpath.js"></script>
<script src="../dom/selector.js"></script>
<script src="../event/event.js"></script>

<script src="../plugins/drag/drag.js"></script>
<script src="../plugins/animation/anim.js"></script>
<script src="../plugins/datalist/datalist.js"></script>




<div id="titulo">asynx AJAX Connector</div><br>
<input type='text' value='eduardo' name='texto' id='texto'>
<input type='text' value='eduardo' name='texto' id='textod'>
<div id="log"></div>

<script>

	var attr = {
		method:'post',
		url:'ajax.php',
		format:'xml',
		charset:'utf-8',
		saveCache:false,
		async: true,
		
		ifModified: true,
		
		onComplete: function(r, args) { var a = r + ":comp:"  + args; asynx$('log').innerHTML += a + "<br>";  },
		onCompleteArgs: [1,2,3],
		
		loading: function(r, args) { var a = r + ":load:"  + args; asynx$('log').innerHTML += a + "<br>"; },
		loadingArgs: [1,2,3,4],
		
		onError: function(r, args) { alert(r + ":erro:"  + args) },
		onErrorArgs: [1,2,3,4,5],
		
		json: false
	};
	
	var attr1 = {
		
		method:'get',
		
		ifModified: true,
		
		json:true,
		
		url:'ajax.php',
		
		format:'text',
		
		onComplete: function(r, args) { var a = r + ":comp:"  + args; asynx$('log').innerHTML += a + "<br><br><br>";  },
		onCompleteArgs: [1,2,3],
		
		loading: function(r, args) { var a = r + ":load:"  + args; asynx$('log').innerHTML += a + "<br>"; },
		loadingArgs: [1,2,3,4],
		
		onError: function(erro, r, args) { alert(erro + "---" + r + ":erro:"  + args) },
		onErrorArgs: [1,2,3,4,5]
		
	};

		var transaction = function() {
			var ajax1 = new asynx.ajax(attr1);
			ajax1.addValue("foo1", "bar1");
			ajax1.addValue("foo2", "bar2");
			ajax1.addValue("foo3", "bar3");
			ajax1.addValue("foo4", "bar4");
			ajax1.addObject('texto');
			ajax1.load();
			
			at2=attr1;
//			at2.url = "teste.xml";
			at2.url = "ajax.php";
			var ajax2 = new asynx.ajax(at2);
			ajax2.addObject('texto');
			ajax2.load();
		}
		
		asynx$('//input').onStopTyping(function(){
			transaction();
		});
		
		
		
		
	/*for (var x=0; x<=10; x++) {
		
		asynx.executeOn(function() {
			
			transaction();
		}, 1);
			
	}*/




	
</script>